package com.tnr.scgcxx;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@SpringBootApplication
@MapperScan("com.tnr.scgcxx.dao")
public class YrzxServApplication {
	public static void main(String[] args) {
		SpringApplication.run(YrzxServApplication.class, args);
	}
	//跨域设置
	@Bean
	public WebMvcConfigurer corsConfigurer() {
		return new WebMvcConfigurer() {
			@Override
			public void addCorsMappings(CorsRegistry registry) {
				registry.addMapping("/**")//允许任意地址接受跨域请求
						.allowCredentials(true)//允许跨域使用session认证
						.allowedMethods("*");//允许任何请求方式跨域
			}
		};
	}
}
